//导入 axios
const axios = require('axios');


(async () => {
  //获取响应体
  let {data} = await axios.get('https://news.163.com/domestic/');
  //正则匹配
  let reg = /<div><a href="(.*?)">(.*?)<\/a><\/div>/g;

  //匹配
  let result = data.matchAll(reg);

  let arr = [];

  for(let v of result){
    arr.push({url: v[1], title: v[2]});
  }

  console.log(arr.map((item, index) => {
    item.id = index + 1;
    return item;
  }));
})()